<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org"
      xmlns:border="http://www.w3.org/1999/xhtml"
      xmlns:outline="http://www.w3.org/1999/xhtml">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <title>用户信息上报</title>
    <script type="text/javascript" src="http://libs.baidu.com/jquery/1.7.2/jquery.min.js"></script>
    <link rel="stylesheet" href="../layui/css/layui.css">
    <style>
        #tips1 {
            border-style: none;
        }
        #tips2 {
            border-style: none;
        }
    </style>
</head>
<body class="layui-layout-body">
<div class="layui-layout layui-layout-admin">

    <!-- layui的水平导航 -->
    <div class="layui-header">
        <div class="layui-logo"><strong>高校健康上报系统</strong></div>
    </div>

    <!-- layui的垂直导航 -->
    <div class="layui-side layui-bg-black">
        <div class="layui-side-scroll">
            <ul class="layui-nav layui-nav-tree"  lay-filter="test">
                <li class="layui-nav-item ">
                    <a href="/zhuye"><i class="layui-icon layui-icon-home"></i>  用户主页</a>
                </li>
                <li class="layui-nav-item layui-this">
                    <a href="/userinfo"><i class="layui-icon layui-icon-survey"></i>  个人信息上报</a>
                </li>
                <li class="layui-nav-item">
                    <a href="/record"><i class="layui-icon layui-icon-log"></i>  上报记录</a>
                </li>
                <li class="layui-nav-item">
                    <a href="/china"><i class="layui-icon layui-icon-list"></i>  国内省份数据</a>
                </li>
                <li class="layui-nav-item">
                    <a href="/global1"><i class="layui-icon layui-icon-list"></i>  全球国家数据</a>
                </li>
                <li class="layui-nav-item">
                    <a href="/regional"><i class="layui-icon layui-icon-list"></i>  全球地区数据</a>
                </li>
                <li class="layui-nav-item">
                    <a href="/logout"><i class="layui-icon layui-icon-logout"></i>  退出系统</a>
                </li>
            </ul>
        </div>
    </div>

    <div class="layui-body" >
        <div ><img th:src="@{/img/lzh.png}"/></div>
        <div align="center" >
        <form th:action="@{/report}" method="post" id="userInfo" onsubmit="return check()">
            <input type="hidden" name="_csrf" th:value="${_csrf.token}">
            <br><br>
            <input id="tips1" th:value="您今天尚未打卡" style="color:#FF0000;outline:none;" readonly="readonly" >
            <input id="tips2" th:value="您今天已提交成功" style="color:#FF0000;outline:none;" readonly="readonly"><br><br>

            <input th:type="hidden" th:name="id" th:value="${userInfo.id}">
            <br><br><br>
            <h4>1.用户</h4>
            <input th:type="text" th:name="username" th:value="${userInfo.username}" readonly="readonly"><br>
            <br>
            <h4>2.姓名</h4>
            <input th:type="text" th:name="name" th:value="${userInfo.name}" id="name">
            <br><br>
            <h4>3.证件类型</h4>
            <input type="hidden" id="idtype" th:value="${userInfo.idtype}"/>
            <select name="idtype" id="idtype1" >
                <option value="1">居民身份证</option>
                <option value="2" >军官证</option>
                <option value="3" >士兵证</option>
                <option value="4">文职干部证</option>
                <option value="5">部队离退休证</option>
                <option value="6">香港特别护照/身份证</option>
                <option value="7">澳门特别护照/身份证</option>
                <option value="8">台湾居民来往大陆通行证</option>
                <option value="9">境外永久居住证</option>
                <option value="10">护照</option>
                <option value="11">户口簿</option>
                <option value="12">其他</option>
            </select>
            <br><br>
            <h4>4.证件号码</h4>
            <input th:type="text" th:name="idnumber" th:value="${userInfo.idnumber}" id="idnumber" maxlength="18">
            <br><br>
            <h4>5.身份类别</h4>
            <input th:type="text" th:name="type" th:value="${userInfo.type}" readonly="readonly"><br>
            <br>
            <h4>6.所在校区</h4>
            <input th:type="text" th:name="campus" th:value="${userInfo.campus}" id="campus">
            <br><br>
            <h4>7.家庭地址</h4>
            <input th:type="text" th:name="address" th:value="${userInfo.address}" id="address">
            <br><br>
            <h4>8.手机号码</h4>
            <input th:type="text" th:name="telnumber" th:value="${userInfo.telnumber}" id="telnumber" maxlength="11">
            <br><br>
            <h4>9.紧急联系人</h4>
            <input th:type="text" th:name="emcontact" th:value="${userInfo.emcontact}" id="emcontact">
            <br><br>
            <h4>10.紧急联系人联系方式</h4>
            <input th:type="text" th:name="emctelnumber" th:value="${userInfo.emctelnumber}" id="emctelnumber" maxlength="11">
            <br><br>
            <h4>11.身体状况</h4>
            <input type="hidden" id="health" th:value="${userInfo.health}"/>
            <select name="health" id="health1" >
                <option value="1">良好</option>
                <option value="2" >异常（发热，体温在37.3°C以上）</option>
                <option value="3" >异常（咳嗽）</option>
                <option value="4">异常（头晕）</option>
                <option value="5">异常（腹泻）</option>
                <option value="6">异常（乏力）</option>
                <option value="7">异常（同时含两种以上症状）</option>
            </select>

            <input type="hidden" th:name="eid" th:value="${record.eid}">
            <br><br>
            <span id="lastTime" th:text="${record.time}" ></span>
            <h4>12.填报日期</h4>
            <input th:type="text" id="punchTime" th:name="time" onfocus="this.blur();"><br>
            <br>
            <h4>13. 14天内是否到达或途径疫情防控重点地区</h4>
            <input type="hidden" id="arrival" th:value="${record.arrival}"/>
            <select name="arrival" id="arrival1" >
                <option value="1">是</option>
                <option value="2" >否</option>
            </select>
            <br><br>
            <h4>14. 14天内是否接触过“近14天出入过疫情重点防控地区”的人员</h4>
            <input type="hidden" id="contactper" th:value="${record.contactper}"/>
            <select name="contactper" id="contactper1" >
                <option value="1">是</option>
                <option value="2" >否</option>
            </select>
            <br><br>
            <h4>15. 14天内是否接触过疑似病例/确诊病例</h4>
            <input type="hidden" id="contactsick" th:value="${record.contactsick}"/>
            <select name="contactsick" id="contactsick1" >
                <option value="1">是</option>
                <option value="2" >否</option>
            </select>
            <br><br>
            <h4>16.是否在莞隔离医学观察</h4>
            <input type="hidden" id="quarantine" th:value="${record.quarantine}"/>
            <select name="quarantine" id="quarantine1" >
                <option value="1">否，没有隔离</option>
                <option value="2" >否，在外地集中隔离或居家观察</option>
                <option value="3" >是，居家观察</option>
                <option value="4" >是，集中隔离</option>
            </select>
            <br><br>
            <h4>17.目前是否在莞</h4>
            <input type="hidden" id="atguan" th:value="${record.atguan}"/>
            <select name="atguan" id="atguan1" >
                <option value="1">是，在莞</option>
                <option value="2" >否，已确定返莞时间</option>
                <option value="3" >否，返莞时间未定</option>
            </select>
            <br><br>
            <h4>18.目前所在镇街</h4>
            <input th:type="text" th:name="streettown" th:value="${record.streettown}" id="streettown">
            <br><br>
            <h4>19.是否在14天内期间新增返莞</h4>
            <input type="hidden" id="returnguan" th:value="${record.returnguan}"/>
            <select name="returnguan" id="returnguan1" >
                <option value="1">是</option>
                <option value="2" >否</option>
            </select>
            <br><br>
            <h4>20. 14天内是否有离莞出行的动作</h4>
            <input type="hidden" id="leaveguan" th:value="${record.leaveguan}"/>
            <select name="leaveguan" id="leaveguan1" >
                <option value="1">否，留莞一直未出行</option>
                <option value="2" >否，一直在异地，期间暂未回莞</option>
                <option value="3">否，期间新增回莞，为出行</option>
                <option value="4" >是，期间偶尔回莞，此时已经回莞</option>
                <option value="5">是，期间偶尔离莞，此时未回莞</option>
            </select>
            <br><br>
            <h4>21.您是否为重点人群</h4>
            <input type="hidden" id="keygroups" th:value="${record.keygroups}"/>
            <select name="keygroups" id="keygroups1" >
                <option value="1">否</option>
                <option value="2" >是，有疑似症状</option>
                <option value="3">是，近14天途径疫情防控重点地区</option>
                <option value="4" >是，最近14天曾接触过“近14天出入过疫情重点防控地区”的人员</option>
                <option value="5" >是，最近14天曾接触过疑似病例或确证病例</option>
            </select>
            <br><br>
            <h4>22. 14天内同住的家庭成员是否有如下情况</h4>
            <input type="hidden" id="situation" th:value="${record.situation}"/>
            <select name="situation" id="situation1" >
                <option value="1">以下均无</option>
                <option value="2" >到达或途径疫情重点防控地区</option>
                <option value="3">接触过近14天出入过疫情重点防控地区的人员</option>
                <option value="4" >接触过疑似病例/确证病例</option>
                <option value="5" >疑似病例/确证病例</option>
            </select>
            <br><br>
            <h4>23.备注</h4>
            <input th:type="text" th:name="remarks" th:value="${record.remarks}"><br>
            <br>
            <h4>24.今日体温（37.3°C以上为异常）</h4>
            <input th:type="text" th:name="temperature" th:value="${record.temperature}" id="temperature">
            <br><br>
            <input th:type="hidden" th:name="ufid" th:value="${record.ufid}">

            <input th:type="submit" id="btn" th:name="submit" style="width: 250px;text-align: center;height: 40px;line-height: 35px;background-color: dodgerblue;border-radius: 10px;color: white; " th:value="提交"><br>
        </form>
        </div>
    </div>

    <script>
        $(function(){
            var idtype=$("#idtype").val();
            var health=$("#health").val();
            var arrival=$("#arrival").val();
            var contactper=$("#contactper").val();
            var contactsick=$("#contactsick").val();
            var quarantine=$("#quarantine").val();
            var atguan=$("#atguan").val();
            var returnguan=$("#returnguan").val();
            var leaveguan=$("#leaveguan").val();
            var keygroups=$("#keygroups").val();
            var situation=$("#situation").val();
            if( idtype !== undefined && idtype !== null ){
                $("#idtype1 option[value='"+idtype+"']").attr("selected", true);
            }
            if( health !== undefined && health !== null ){
                $("#health1 option[value='"+health+"']").attr("selected", true);
            }
            if( arrival !== undefined && arrival !== null ){
                $("#arrival1 option[value='"+arrival+"']").attr("selected", true);
            }
            if( contactper !== undefined && contactper !== null ){
                $("#contactper1 option[value='"+contactper+"']").attr("selected", true);
            }
            if( contactsick !== undefined && contactsick !== null ){
                $("#contactsick1 option[value='"+contactsick+"']").attr("selected", true);
            }
            if( quarantine !== undefined && quarantine !== null ){
                $("#quarantine1 option[value='"+quarantine+"']").attr("selected", true);
            }
            if( atguan !== undefined && atguan !== null ){
                $("#atguan1 option[value='"+atguan+"']").attr("selected", true);
            }
            if( returnguan !== undefined && returnguan !== null ){
                $("#returnguan1 option[value='"+returnguan+"']").attr("selected", true);
            }
            if( leaveguan !== undefined && leaveguan !== null ){
                $("#leaveguan1 option[value='"+leaveguan+"']").attr("selected", true);
            }
            if( keygroups !== undefined && keygroups !== null ){
                $("#keygroups1 option[value='"+keygroups+"']").attr("selected", true);
            }
            if( situation !== undefined && situation !== null ){
                $("#situation1 option[value='"+situation+"']").attr("selected", true);
            }


            let today = new Date( ) ;
            let year = today.getUTCFullYear() ;
            let month = today.getUTCMonth() + 1 ;
            let date = today.getDate() ;
            let lastTime = $('#lastTime').text( ) ;
            let judgeTemp = year + '-' + month + '-' + date ;
            let lastTimeArr = lastTime.split( '-' ) ;
            $('#lastTime').hide() ;
            $( '#punchTime' ).val( judgeTemp )
            console.log( $( '#punchTime' ).val( )) ;
            if( Number( lastTimeArr[0] ) === year && Number( lastTimeArr[1] )  === month && Number( lastTimeArr[2] ) === date ) {
                $('#btn').hide() ;
                $('#tips1').hide();
            }else {
                $('#tips2').hide();
            }

        });
    </script>

    <script  type = "text/JavaScript">
        function check(){
            var name = document.getElementById('name').value;
            var idnumber =  document.getElementById('idnumber').value;
            var campus = document.getElementById('campus').value;
            var address = document.getElementById('address').value;
            var telnumber = document.getElementById('telnumber').value;
            var emcontact = document.getElementById('emcontact').value;
            var emctelnumber = document.getElementById('emctelnumber').value;
            var streettown = document.getElementById('streettown').value;
            var temperature = document.getElementById('temperature').value;

            if(name == null || name == ""){
                alert("姓名不能为空");
                return false;
            }
            if(idnumber == null || idnumber == ""){
                alert("证件号码不能为空");
                return false;
            }
            if(campus == null || campus == ""){
                alert("所在校区不能为空");
                return false;
            }
            if(address == null || address == ""){
                alert("家庭地址不能为空");
                return false;
            }
            if(telnumber == null || telnumber == ""){
                alert("电话号码不能为空");
                return false;
            }
            if(emcontact == null || emcontact == ""){
                alert("紧急联系人不能为空");
                return false;
            }
            if(emctelnumber == null || emctelnumber == ""){
                alert("紧急联系人联系方式不能为空");
                return false;
            }
            if(streettown == null || streettown == ""){
                alert("目前所在镇街不能为空");
                return false;
            }
            if(temperature == null || temperature == ""){
                alert("今日温度不能为空");
                return false;
            }
            return true;
        }
    </script>

</div>
</body>
</html>